<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
     img {
         height: 200px;
         width: 300px;
     }
    </style>
</head>
<body>
    <img src="img/1.jpg"  id="im1">
    <img src="img/2.jpg"  id="im2">
    <img src="img/3.jpg"  id="im3">
    <script>
     document.getElementById("im1").onclick = function (){
         alert("img1")
     };
     document.getElementById("im2").onclick = function (){
         alert("img2")
     };
     document.getElementById("im3").onclick = function (){
         alert("im3")
     };
    </script>
</body>
</html>